// 2.引入常态化样式表
require("../../assets/css/normalize.css");
// 1.引入重置样式表
require("../../assets/css/reset.css");
// 3.引入公共样式
require("../../assets/css/common.css");
//3.1引入字体图标样式
require("../../assets/fonts/iconfont.css");
require("../../assets/css/tabbar.less");
require("../../assets/css/navbar.less");
// 4.引入当前页样式
require("./sports_run.less");

//引入js模块
const dom = require("../../utils/dom.js");
const axios = require("../../utils/axios.js");

window.document.addEventListener("DOMContentLoaded",function(){
    	// 1.渲染tabbar
	dom.tabbar("sports");

	// 2.渲染顶部导航navbar
	dom.navbar("run");

    // 点击go开始倒计时

    dom.get("#goBtn").addEventListener("click", function(){
        // 蒙层出现
        dom.get("#mask").style.display = "block";
        dom.get("#box").style.display = "block";
        // 倒计时
        let n=3;
        setInterval(function(){
            n--;
            dom.get("#box").textContent = n;
            if(n===0){
                location.href="sports_running.html"
            }
        },1000)
    })
    axios.get("/api/exercise").then((res) => {
		console.log(res);
		dom.get("#total").textContent = res.data.data.sum7Meter / 1000;
	});


})